package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StbGrantMapper;
import com.ruoyi.system.domain.StbGrant;
import com.ruoyi.system.service.IStbGrantService;
import com.ruoyi.common.core.text.Convert;

/**
 * 资助Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-02-08
 */
@Service
public class StbGrantServiceImpl implements IStbGrantService 
{
    @Autowired
    private StbGrantMapper stbGrantMapper;

    /**
     * 查询资助
     * 
     * @param grantId 资助ID
     * @return 资助
     */
    @Override
    public StbGrant selectStbGrantById(Long grantId)
    {
        return stbGrantMapper.selectStbGrantById(grantId);
    }

    /**
     * 查询资助列表
     * 
     * @param stbGrant 资助
     * @return 资助
     */
    @Override
    public List<StbGrant> selectStbGrantList(StbGrant stbGrant)
    {
        return stbGrantMapper.selectStbGrantList(stbGrant);
    }

    /**
     * 新增资助
     * 
     * @param stbGrant 资助
     * @return 结果
     */
    @Override
    public int insertStbGrant(StbGrant stbGrant)
    {
        stbGrant.setCreateTime(DateUtils.getNowDate());
        return stbGrantMapper.insertStbGrant(stbGrant);
    }

    /**
     * 修改资助
     * 
     * @param stbGrant 资助
     * @return 结果
     */
    @Override
    public int updateStbGrant(StbGrant stbGrant)
    {
        stbGrant.setUpdateTime(DateUtils.getNowDate());
        return stbGrantMapper.updateStbGrant(stbGrant);
    }

    /**
     * 删除资助对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStbGrantByIds(String ids)
    {
        return stbGrantMapper.deleteStbGrantByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除资助信息
     * 
     * @param grantId 资助ID
     * @return 结果
     */
    @Override
    public int deleteStbGrantById(Long grantId)
    {
        return stbGrantMapper.deleteStbGrantById(grantId);
    }
	/*
	 * 查询各类企业资助
	 */

	@Override
	public List<Map<String, Object>> selectGrantMoneyCount(StbGrant stbGrant) {
		
		return stbGrantMapper.selectGrantMoneyCount(stbGrant);
	}



}
